﻿using HtmlAgilityPack;

namespace JoelAbrahamsson.Web.Common.HtmlFiltering
{
    public class QuoteTagReplacer : IHtmlTagReplacer
    {
        public string ReplaceOpeningTag(HtmlNode node)
        {
            string opening = "<blockquote class=\"commentQuoute\">";
            if (node.Attributes["cite"] != null && !string.IsNullOrEmpty(node.Attributes["cite"].Value))
                opening += string.Format("<cite>{0} wrote:</cite>", node.Attributes["cite"].Value);
            return opening;
        }

        public string ReplaceClosingTag(HtmlNode node)
        {
            return "</blockquote>";
        }
    }
}
